//
//  NewsCell.m
//  HWSGW
//
//  Created by avachen on 15/11/3.
//  Copyright © 2015年 luxuanrui. All rights reserved.
//

#import "NewsCell.h"
#import "UIImageView+WebCache.h"
#import "UIViewExt.h"

@implementation NewsCell

- (void)awakeFromNib {
    // Initialization code
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    //给第2种单元格传输数据
    NSString *urlString = self.news.image;
    [_imgView sd_setImageWithURL:[NSURL URLWithString:urlString]];
    
    _titleLabel.text = self.news.title;
    _summaryLabel.text = self.news.summary;
    
    NSInteger type = [self.news.type integerValue];
    
    //根据新闻类型来设置icon
    if (type == 0) { //普通新闻
        _iconImg.hidden = YES;
        _summaryLabel.left = _imgView.right + 10;
        
    }else if (type == 1){ //图片新闻
        _iconImg.image = [UIImage imageNamed:@"sctpxw"];
        _iconImg.hidden = NO;
        _summaryLabel.left = _iconImg.right + 5;
        
        
    }else if (type == 2){
        _iconImg.image = [UIImage imageNamed:@"scspxw"];
        _iconImg.hidden = NO;
        _summaryLabel.left = _iconImg.right + 5;
        
    }
    
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
